home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Topik
/
Topik - Disk 02 - Fonts and CLI Commands (19xx)(Topik Public Domain)(PD)[a][WB].zip
/
Topik - Disk 02 - Fonts and CLI Commands (19xx)(Topik Public Domain)(PD)[a][WB].adf
/
Source
/
mkidir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-04-19
|
3KB
|
79 lines
/* mkidir, creates a subdirectory ala ADOS makedir with the exception
it adds a icon file for the directory, same command syntax
Donald Wahl 6-19-87 */
#include <stdio.h>
#include <ctype.h>
#include "libraries/dos.h"
#include "libraries/dosextens.h"
#include "exec/types.h"
#include "exec/memory.h"
#include "functions.h"
/* data for one each plain directory .info file (WBDRAWER) */
/* opens at NO_ICON_POSITION to allow workbench to avoid overlap */
UWORD infodat[173] = {
0xE310,0x0001,0x0000,0x0000,0x0000,0x0000,0x0040,0x000D,
0x0004,0x0003,0x0001,0x0024,0x85B0,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0274,0x0000,0x0000,0x0000,0x0000,0x8000,0x0000,0x8000,
0x0000,0x0001,0x54E0,0x0000,0x0000,0x0000,0x0000,0x010B,
0x0017,0x012F,0x0079,0xFFFF,0x0000,0x0000,0x0240,0x027F,
0x0001,0x5554,0x0000,0x0000,0x0020,0x5958,0x0000,0x0000,
0x0000,0x0000,0x005A,0x0028,0xFFFF,0xFFFF,0x0001,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0040,0x000C,0x0002,
0x0001,0x4100,0x0300,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x3FFF,0xFFFF,0xFFFF,0xFFFC,0x3C00,0x0000,0x0000,
0x003C,0x3CFF,0xFFFF,0xFFFF,0xFF3C,0x3CFF,0xFFFF,0xFFFF,
0xFF3C,0x3CFF,0xFF3F,0xFCFF,0xFF3C,0x3CFF,0xFF00,0x00FF,
0xFF3C,0x3CFF,0xFFFF,0xFFFF,0xFF3C,0x3CFF,0xFFFF,0xFFFF,
0xFF3C,0x3C00,0x0000,0x0000,0x003C,0x3FFF,0xFFFF,0xFFFF,
0xFFFC,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0xFFFF,
0xFFFF,0xC000,0x0000,0x0000,0x0003,0xC3FF,0xFFFF,0xFFFF,
0xFFC3,0xC300,0x0000,0x0000,0x00C3,0xC300,0x0000,0x0000,
0x00C3,0xC300,0x00C0,0x0300,0x00C3,0xC300,0x00FF,0xFF00,
0x00C3,0xC300,0x0000,0x0000,0x00C3,0xC300,0x0000,0x0000,
0x00C3,0xC3FF,0xFFFF,0xFFFF,0xFFC3,0xC000,0x0000,0x0000,
0x0003,0xFFFF,0xFFFF,0xFFFF,0xFFFF };
main(argc,argv)
int argc;
char *argv[];
{
struct FileLock *lock = NULL;
struct FileHandle *infofile = NULL;
char iconname[120];
if(argc != 2) /* check for one arg (dir name) */
showusage();
lock = Lock(argv[1]);
if(lock)
{ Write(Output(),"directory already exists\n",25l);
UnLock(lock);
exit(20); }
lock = CreateDir(argv[1]);
if(!lock)
{ Write(Output(),"Make directory failed\n",22l);
exit(20); }
UnLock(lock);
/* makeup icon file name */
strcpy(iconname,argv[1]);
strcat(iconname,".info");
if ((infofile = Open(iconname, MODE_NEWFILE)) == NULL)
{ Write(Output(),".info file Open failure\n",24l);
exit(20); }
Write(infofile,infodat,346l);
Close(infofile);
exit(0);
}
showusage()
{
Write(Output(),"USAGE:\nmkidir directory_path\n",29l);
exit(0);
}